<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../jquery-3.1.1.js"></script>
</head>

<body>

</body>
<script>
    $(function () {
        let ooo = 0;
        let nnn = 0;
        let str = 'want you to know one thing '
        let n = /[no]/g;
        let sz = str.match(n)
        console.log(sz)
        for (let i = 0; i < sz.length; i++) {
            if (sz[i] == 'o') {
                ++ooo;
            } else if(sz[i] == 'n'){
                ++nnn;
            }
            
        }
        console.log('o的个数' + ooo);
        console.log('n的个数' + nnn);
    })
</script>

</html>